<DOCTYPE html>
<!--HTML5 doctype-->
<html>
<head>
	<title>护理文书</title>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<link rel="stylesheet" type="text/css" href="../../css/jquery.mobile-1.4.0.css" />
	<link rel="stylesheet" type="text/css" href="../../css/zpdydhl_mobile.css">
	<link rel="stylesheet" type="text/css" href="../../css/mobiscroll.custom-2.6.2.min.css">
	<script type="text/javascript" src="../../js/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="../../js/jquery.mobile-1.4.0.min.js"></script>
	<script type="text/javascript" src="../../js/zpdydhl_mobile.js"></script>
	<script type="text/javascript" src="../../js/mobiscroll.custom-2.6.2.min.js"></script>
	<style type="text/css">
	.replaceable_tips { 
		padding:5px; 
		width:auton; 
		/*max-height:150px;*/ 
		position:absolute; 
		z-index:100; 
		background-color:#EAEAEA; 
		border:1px solid 
		blue;
	}
	.replaceable_tips li {
		cursor:pointer; 
		list-style:none; 
		width:100%; 
		line-height:25px; 
		font-size:20px; 
		text-align:left;
		margin-top: 5px;
	}
	.replaceable_tips li:hover {background-color:#6A6A6A}
	.error_state { color:#F00;cursor:pointer;}
	.right_state { color:#063;cursor:pointer;}
	.replace_state { color:#063;cursor:pointer;}

	.hulijilu_table{ width:100%; margin-bottom:10px;}
	.hulijilu_table tr td{border:1px solid #c5dbf2;height:36px;}
	.content_edit{border:1px dashed #1e8cc3;display:block;min-height:30px;line-height:30px;word-break: break-all;word-wrap: break-word;}
	</style>
</head>
<body>
	<div data-role="page" data-theme="c" id="page">
	 	
		<div class="content" style="padding:8px;" contenteditable="false">
			
				
			
		</div>
		<input type="hidden" name="id" value="">
		<script type='text/javascript'>
			var col_title;
			$(function () {
				huliwenshu_id=getRequestOne("huliwenshu_id");
				huli_wenshu_type = decodeURI(getRequestOne("type"));
				
			})
			function refreshData()
			{
				$.ajax({
					type: "get",
					async: false,
					url:server_url+"Mobile/HuliWenshu/addSubContentWenshuJson"+yiyuan_id,
					data: { id : huliwenshu_id,zhuyuan_id:patient_info_global.zhuyuan_id,user_number:nurse_info_global.user_number},
					dataType: "jsonp",
					jsonp: "callbackShowDetailHuliWenshuJson",
					jsonpCallback:"feedBackStateShowDetailHuliWenshuJson",
					error:function(mes)
					{
						alert(mes);
					},
					success: function(result) {
						
						if(result.ret=="success")
						{
							$("#save").css("display","block");
							var str = '<table border="0" cellpadding="0" cellspacing="0" class="hulijilu_table">';
							col_title='{';
							for (var i=0;i<result.data.length;i++)
							{
								str +='<tr><td width="150px" class="hulijilu_table_title">'+result.data[i]+':</td><td><div contenteditable="true" class="content_edit" name="col'+eval(i+1)+'"></div></td></tr>';
								col_title+='"col'+eval(i+1)+'"'+':"'+result.data[i]+'",';
							}
							col_title = col_title.substr(0,col_title.length-1)
							col_title+='}';
							col_title = JSON.parse(col_title);
							str +='</table>';
							$('.content').html(str);
							$("[name='id']").val(result.id)
						}
						else
							alert("失败");
					}
				});
			}
			$(".prev").die().live("click",function(){
				window.location.href="./editHuliwenshu.html?huliwenshu_id="+$("[name='id']").val()+"&type="+huli_wenshu_type;
			});
			$("#save").die().live("click",function(){
				var col_data='{';
				$(".content_edit").each(function(){
					col_data+='"'+$(this).attr('name')+'"'+':"'+$(this).text()+'",';
				})
				col_data = col_data.substr(0,col_data.length-1)
				col_data+='}';
				col_data = JSON.parse(col_data)
				//console.log(col_data);
				url=server_url+"Mobile/HuliWenshu/updateHuliWenshu"+yiyuan_id,
				$.post(url,{id:$("[name='id']").val(),col_title:col_title,col_data:col_data,user_number:nurse_info_global.user_number},function(data){
					alert(data);
					window.location.href="./editHuliwenshu.html?huliwenshu_id="+$("[name='id']").val()+"&type="+huli_wenshu_type;
				})
			});
		</script>
	</div>
</body>
</html>